Nowadays various applications have user interfaces designed to use specific functions and accomplish certain goals through a sequence of operations. Some of these processes/activities are repetitive in nature. Most of these processes/activities have associated rules and specific sequence of actions to be followed to complete the task, for example, use of a web application to book a travel ticket, using an SAP application to allocate resources, etc. Typically, various bots (also referred to as “BOTs” in this disclosure) are created and assigned tasks to automate such processes/activities. Once the bot (also referred to as “BOT” in this disclosure) is created for a particular task, the BOT can perform the task whenever an instruction is received to perform the task. However, in case, a user is performing a task, the BOTs are incapable of following a user's actions, system behavior, system response, error conditions, key board shortcuts, and extracting of a goal of the task therefrom.